package com.yc.cloud.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yc.cloud.dto.AnswerModelDto;
import com.yc.cloud.entity.Answer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 答题库 Mapper 接口
 * </p>
 *
 * @author Yancy
 * @since 2024-01-31
 */
@Mapper
public interface AnswerMapper extends BaseMapper<Answer> {

    String querySql = "SELECT r.name as questionName,l.* FROM answer l inner join question r on l.question_no=r.question_no ";
    String wrapperSql = "SELECT * from ( " + querySql + " ) AS q ${ew.customSqlSegment}";

    @Select(wrapperSql)
    IPage<AnswerModelDto> listPage(IPage<Answer> page, @Param("ew") Wrapper<Answer> query);
}
